diff options
author | Alan Pearce | 2024-05-17 17:34:01 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-17 17:34:01 +0200 |
commit | f9b034027565bbc59b36d1a318716088c3a77977 (patch) | |
tree | c3d3d4f0063a603fd8cba46ea7d42a3fd6ade9fa /internal | |
parent | 3b877b39b424ded0f776d1dc71d07616a47bfbd4 (diff) | |
download | searchix-f9b034027565bbc59b36d1a318716088c3a77977.tar.lz searchix-f9b034027565bbc59b36d1a318716088c3a77977.tar.zst searchix-f9b034027565bbc59b36d1a318716088c3a77977.zip |
fix: missing last page of search results
Diffstat (limited to 'internal')
-rw-r--r-- | internal/server/mux.go | 3 |
1 files changed, 2 insertions, 1 deletions
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 |