0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-22 13:44:13 +01:00

Fix pagination() to get the right total number of pages

This commit is contained in:
Eryx 2014-10-14 09:54:45 +08:00
parent 4a8a70dde0
commit fb8beaf19a

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
}