From fb8beaf19a2a1cb81619681a78bf24a55ce3da64 Mon Sep 17 00:00:00 2001 From: Eryx Date: Tue, 14 Oct 2014 09:54:45 +0800 Subject: [PATCH] Fix pagination() to get the right total number of pages --- routers/admin/users.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/routers/admin/users.go b/routers/admin/users.go index c9adf2d85..351044532 100644 --- a/routers/admin/users.go +++ b/routers/admin/users.go @@ -5,6 +5,7 @@ package admin import ( + "math" "strings" "github.com/Unknwon/com" @@ -30,7 +31,7 @@ func pagination(ctx *middleware.Context, count int64, pageNum int) int { } curCount := int64((p-1)*pageNum + pageNum) if curCount >= count { - p = int(count) / pageNum + p = int(math.Ceil(float64(count) / float64(pageNum))) } else { ctx.Data["NextPageNum"] = p + 1 }