From f9b034027565bbc59b36d1a318716088c3a77977 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 17 May 2024 17:34:01 +0200 Subject: fix: missing last page of search results --- internal/server/mux.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/server/mux.go b/internal/server/mux.go index 27cd4bf..c5ba97a 100644 --- a/internal/server/mux.go +++ b/internal/server/mux.go @@ -7,6 +7,7 @@ import ( "io" "log" "log/slog" + "math" "net/http" "net/url" "os" @@ -163,7 +164,7 @@ func NewMux( return } - if page*search.ResultsPerPage > results.Total { + if page > uint64(math.Ceil(float64(results.Total)/search.ResultsPerPage)) { errorHandler(w, r, "Not found", http.StatusNotFound) return -- cgit 1.4.1