diff options
-rw-r--r-- | frontend/utility.go | 4 | ||||
-rw-r--r-- | modules/tags/tags.go | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/frontend/utility.go b/frontend/utility.go index 28e7db1..6dbef6a 100644 --- a/frontend/utility.go +++ b/frontend/utility.go | |||
@@ -13,7 +13,7 @@ func PaginationFromPage(pageRange, currentPage, maxPage int) PaginationRange { | |||
13 | var after []int | 13 | var after []int |
14 | 14 | ||
15 | startPage := currentPage - pageRange | 15 | startPage := currentPage - pageRange |
16 | endPage := currentPage + pageRange + 1 | 16 | endPage := currentPage + pageRange |
17 | 17 | ||
18 | if startPage < 1 { | 18 | if startPage < 1 { |
19 | endPage += -startPage + 1 | 19 | endPage += -startPage + 1 |
@@ -36,7 +36,7 @@ func PaginationFromPage(pageRange, currentPage, maxPage int) PaginationRange { | |||
36 | before = append(before, i) | 36 | before = append(before, i) |
37 | } | 37 | } |
38 | 38 | ||
39 | for i := currentPage + 1; i < endPage; i++ { | 39 | for i := currentPage + 1; i < endPage+1; i++ { |
40 | after = append(after, i) | 40 | after = append(after, i) |
41 | } | 41 | } |
42 | 42 | ||
diff --git a/modules/tags/tags.go b/modules/tags/tags.go index 650fa4e..4019f8a 100644 --- a/modules/tags/tags.go +++ b/modules/tags/tags.go | |||
@@ -2,6 +2,7 @@ package tags | |||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "log" | 4 | "log" |
5 | "math" | ||
5 | "net/http" | 6 | "net/http" |
6 | "strconv" | 7 | "strconv" |
7 | 8 | ||
@@ -77,7 +78,7 @@ func (m *Module) viewTagPage(w http.ResponseWriter, r *http.Request, p httproute | |||
77 | http.Redirect(w, r, "/", 302) | 78 | http.Redirect(w, r, "/", 302) |
78 | return | 79 | return |
79 | } | 80 | } |
80 | pageCount := (int)((float64)(pageNum)/12.0 + 0.5) | 81 | pageCount := (int)(math.Ceil(float64(pageNum) / 12.0)) |
81 | 82 | ||
82 | if pageNumber > pageCount { | 83 | if pageNumber > pageCount { |
83 | pageNumber = pageCount | 84 | pageNumber = pageCount |