aboutsummaryrefslogtreecommitdiffstats
path: root/routers/home.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/home.go')
-rw-r--r--routers/home.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/routers/home.go b/routers/home.go
index 14a123f10b..73324d4587 100644
--- a/routers/home.go
+++ b/routers/home.go
@@ -7,6 +7,8 @@ package routers
import (
"fmt"
+ "github.com/Unknwon/paginater"
+
"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/middleware"
@@ -50,7 +52,14 @@ func Explore(ctx *middleware.Context) {
ctx.Data["Title"] = ctx.Tr("explore")
ctx.Data["PageIsExploreRepositories"] = true
- repos, err := models.GetRecentUpdatedRepositories(20)
+ page := ctx.QueryInt("page")
+ if page <= 1 {
+ page = 1
+ }
+
+ ctx.Data["Page"] = paginater.New(int(models.CountRepositories()), setting.ExplorePagingNum, page, 5)
+
+ repos, err := models.GetRecentUpdatedRepositories(page)
if err != nil {
ctx.Handle(500, "GetRecentUpdatedRepositories", err)
return