From c0ce381379ab14370827a16d3e013996144a8a43 Mon Sep 17 00:00:00 2001 From: "Rafael E. O'Neill" <106079170+RafaelOAiSquared@users.noreply.github.com> Date: Thu, 26 Dec 2024 04:25:54 -0400 Subject: [PATCH] fix(CE): pagination fix for empty data (#546) Co-authored-by: afthab vp --- server/config/initializers/custom_pagination_links.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/config/initializers/custom_pagination_links.rb b/server/config/initializers/custom_pagination_links.rb index a57ca3ce..e39f93cc 100644 --- a/server/config/initializers/custom_pagination_links.rb +++ b/server/config/initializers/custom_pagination_links.rb @@ -23,8 +23,8 @@ def pages_from {}.tap do |pages| pages[:first] = FIRST_PAGE pages[:prev] = first_page? ? nil : collection.current_page - FIRST_PAGE - pages[:next] = last_page? ? nil : collection.current_page + FIRST_PAGE - pages[:last] = collection.total_pages + pages[:next] = (!last_page? && collection.total_pages > 1) ? collection.current_page + FIRST_PAGE : nil + pages[:last] = [collection.total_pages, FIRST_PAGE].max end end