From 2860552c94ed4e3197f9580614adf06ebea19f98 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Wed, 17 Sep 2025 05:59:41 -0700 Subject: [PATCH] Fix total_pages calculation to respect X-Per-Page header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The total_pages method was using the hardcoded SEARCH_PER_PAGE constant instead of the dynamic search_page_size value from the X-Per-Page header. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- app/controllers/api/v1/search_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/search_controller.rb b/app/controllers/api/v1/search_controller.rb index 8bfbfc4..d3eddf0 100644 --- a/app/controllers/api/v1/search_controller.rb +++ b/app/controllers/api/v1/search_controller.rb @@ -275,7 +275,8 @@ module Api private def total_pages(count) - count.to_f / SEARCH_PER_PAGE > 1 ? (count.to_f / SEARCH_PER_PAGE).ceil : 1 + per_page = search_page_size + (count.to_f / per_page).ceil end # Specify whitelisted properties that can be modified.