From b0398c7db06fa63d54d805b7e8858db5332b4ce1 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Mon, 5 Dec 2016 11:12:37 -0800 Subject: adding link click prevention for disabled pagination elements, fixing case where count > total and reassigning total = count --- system/admin/handlers.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'system') diff --git a/system/admin/handlers.go b/system/admin/handlers.go index e91c5db..c505914 100644 --- a/system/admin/handlers.go +++ b/system/admin/handlers.go @@ -964,17 +964,30 @@ func postsHandler(res http.ResponseWriter, req *http.Request) { nextStatus = statusDisabled } + // set up pagination values urlFmt := req.URL.Path + "?count=%d&offset=%d&status=%s&type=%s" prevURL := fmt.Sprintf(urlFmt, count, offset-1, status, t) nextURL := fmt.Sprintf(urlFmt, count, offset+1, status, t) start := 1 + count*offset - end := start + count + end := start + count - 1 + if total < count { + total = count + } + pagination := fmt.Sprintf(` + `, prevStatus, prevURL, start, end, total, nextStatus, nextURL) b.Write([]byte(pagination + ``)) -- cgit v1.2.3