diff --git a/routers/web/repo/commit.go b/routers/web/repo/commit.go
index 164dc181f0..a6553256b0 100644
--- a/routers/web/repo/commit.go
+++ b/routers/web/repo/commit.go
@@ -83,7 +83,7 @@ func Commits(ctx *context.Context) {
 	ctx.Data["CommitCount"] = commitsCount
 	ctx.Data["RefName"] = ctx.Repo.RefName
 
-	pager := context.NewPagination(int(commitsCount), setting.Git.CommitsRangeSize, page, 5)
+	pager := context.NewPagination(int(commitsCount), pageSize, page, 5)
 	pager.SetDefaultParams(ctx)
 	ctx.Data["Page"] = pager