1
1
mirror of https://github.com/go-gitea/gitea synced 2024-11-19 00:24:31 +00:00

Merge pull request #561 from eryx/master

Fix pagination() to get the right total number of pages
This commit is contained in:
无闻 2014-10-13 22:47:21 -04:00
commit 1a38f0e0d9

View File

@ -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
}