Cleaned up pagination calculations

This commit is contained in:
Seednode 2023-09-09 23:27:40 -05:00
parent 1e11515b58
commit 30eead7e2f
2 changed files with 5 additions and 2 deletions

View File

@ -17,7 +17,7 @@ var (
) )
const ( const (
Version string = "0.59.2" Version string = "0.59.3"
) )
var ( var (

View File

@ -692,8 +692,11 @@ func serveDebugHtml(args []string, index *Index, paginate bool) httprouter.Handl
} }
if pageLength != 0 { if pageLength != 0 {
nextPage := page + 1 nextPage := page + 1
if nextPage > (fileCount / int(pageLength)) {
if nextPage > (fileCount/int(pageLength)) && fileCount%int(pageLength) == 0 {
nextPage = fileCount / int(pageLength) nextPage = fileCount / int(pageLength)
} else if nextPage > (fileCount / int(pageLength)) {
nextPage = (fileCount / int(pageLength)) + 1
} }
prevPage := page - 1 prevPage := page - 1