Skip to content

Commit

Permalink
LPS-193394 Avoid using count to get the activePage
Browse files Browse the repository at this point in the history
  • Loading branch information
ealonso authored and brianchandotcom committed Aug 13, 2023
1 parent d7fac21 commit 3d9a9cf
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,20 @@ public int getActivePage() {
return _activePage;
}

_activePage = Math.max(
1,
Math.min(
getNumberOfPages(),
ParamUtil.getInteger(
PortalUtil.getOriginalServletRequest(_httpServletRequest),
PAGE_NUMBER_PARAM_PREFIX +
_collectionStyledLayoutStructureItem.getItemId(),
1)));
_activePage = ParamUtil.getInteger(
PortalUtil.getOriginalServletRequest(_httpServletRequest),
PAGE_NUMBER_PARAM_PREFIX +
_collectionStyledLayoutStructureItem.getItemId(),
1);

int numberOfPages =
_collectionStyledLayoutStructureItem.getNumberOfPages();

if (!_collectionStyledLayoutStructureItem.isDisplayAllPages() &&
(_activePage > numberOfPages)) {

_activePage = numberOfPages - 1;
}

return _activePage;
}
Expand Down

0 comments on commit 3d9a9cf

Please sign in to comment.