diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-12-05 11:17:18 -0800 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-12-05 11:17:18 -0800 |
commit | 4439971245ee470fca74f2e0c07d2f049290fce9 (patch) | |
tree | c25a82f9ff8975e6a9b4f9294c7976fa3e19d731 | |
parent | 3f07c202373d4d31d74c5430fd83bbac6d07fdde (diff) |
evaluating and reassigning count earlier to cascade to lower calcs which depend on the value
-rw-r--r-- | system/admin/handlers.go | 5 |
1 files changed, 3 insertions, 2 deletions
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(` <ul class="pagination row"> |