Fix: next page is broken when there is no page limit #34

This commit is contained in:
vnpower
2023-10-21 15:49:26 +07:00
parent 648ee9fa9b
commit e7d1ca7362
+2 -1
View File
@@ -133,11 +133,12 @@ func CreatePaginator(base, ending string, current_page, max_page int) template.H
count++
}
pages += fmt.Sprintf(`<a href="%s%d%s" class="pagination-button">&rsaquo;</a>`, base, min(max_page, current_page+1), ending)
if max_page == -1 {
pages += fmt.Sprintf(`<a href="%s%d%s" class="pagination-button">&rsaquo;</a>`, base, current_page+1, ending)
pages += fmt.Sprintf(`<a href="%s%d%s" class="pagination-button" id="disabled">&raquo;</a>`, base, max_page, ending)
} else {
pages += fmt.Sprintf(`<a href="%s%d%s" class="pagination-button">&rsaquo;</a>`, base, min(max_page, current_page+1), ending)
pages += fmt.Sprintf(`<a href="%s%d%s" class="pagination-button">&raquo;</a>`, base, max_page, ending)
}