about summary refs log tree commit diff stats
path: root/internal/server
diff options
context:
space:
mode:
authorAlan Pearce2024-05-17 17:34:01 +0200
committerAlan Pearce2024-05-17 17:34:01 +0200
commitf9b034027565bbc59b36d1a318716088c3a77977 (patch)
treec3d3d4f0063a603fd8cba46ea7d42a3fd6ade9fa /internal/server
parent3b877b39b424ded0f776d1dc71d07616a47bfbd4 (diff)
downloadsearchix-f9b034027565bbc59b36d1a318716088c3a77977.tar.lz
searchix-f9b034027565bbc59b36d1a318716088c3a77977.tar.zst
searchix-f9b034027565bbc59b36d1a318716088c3a77977.zip
fix: missing last page of search results
Diffstat (limited to 'internal/server')
-rw-r--r--internal/server/mux.go3
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