From 30eead7e2f3937764cb354c3029f09283f9b0e2f Mon Sep 17 00:00:00 2001 From: Seednode Date: Sat, 9 Sep 2023 23:27:40 -0500 Subject: [PATCH] Cleaned up pagination calculations --- cmd/root.go | 2 +- cmd/web.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index c5863e5..2f34c1e 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -17,7 +17,7 @@ var ( ) const ( - Version string = "0.59.2" + Version string = "0.59.3" ) var ( diff --git a/cmd/web.go b/cmd/web.go index a77ccd4..1d41653 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -692,8 +692,11 @@ func serveDebugHtml(args []string, index *Index, paginate bool) httprouter.Handl } if pageLength != 0 { nextPage := page + 1 - if nextPage > (fileCount / int(pageLength)) { + + if nextPage > (fileCount/int(pageLength)) && fileCount%int(pageLength) == 0 { nextPage = fileCount / int(pageLength) + } else if nextPage > (fileCount / int(pageLength)) { + nextPage = (fileCount / int(pageLength)) + 1 } prevPage := page - 1