From 4439971245ee470fca74f2e0c07d2f049290fce9 Mon Sep 17 00:00:00 2001 From: Steve Manuel Date: Mon, 5 Dec 2016 11:17:18 -0800 Subject: evaluating and reassigning count earlier to cascade to lower calcs which depend on the value --- system/admin/handlers.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'system') diff --git a/system/admin/handlers.go b/system/admin/handlers.go index 765ea6f..fb4d555 100644 --- a/system/admin/handlers.go +++ b/system/admin/handlers.go @@ -968,11 +968,12 @@ func postsHandler(res http.ResponseWriter, req *http.Request) { 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 - 1 + // total may be less than 10 (default count), so reset count to match total if total < count { count = total } + start := 1 + count*offset + end := start + count - 1 pagination := fmt.Sprintf(`