From 8480f7156c123134ded3d41d86b8e003a25735e6 Mon Sep 17 00:00:00 2001 From: Ron Lavi <1ronlavi@gmail.com> Date: Tue, 2 Jan 2024 11:07:56 +0000 Subject: [PATCH] Fixes #36469 - fix the pagination algorithm --- webpack/helpers/pageParamsHelper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack/helpers/pageParamsHelper.js b/webpack/helpers/pageParamsHelper.js index bbe5aae0..534cd428 100644 --- a/webpack/helpers/pageParamsHelper.js +++ b/webpack/helpers/pageParamsHelper.js @@ -31,7 +31,7 @@ export const useCurrentPagination = history => { */ export const pageToVars = ({ page, per_page }, totalCount = 0) => ({ first: page * per_page, - last: page > 1 && totalCount > 0 ? totalCount - per_page : per_page, + last: Math.min(per_page, totalCount - (page - 1) * per_page), }); export const useParamsToVars = (history, totalCount) =>