diff --git a/src/components/common/Pagination.tsx b/src/components/common/Pagination.tsx index 1c0e9de2a2..3dd5a60ffd 100644 --- a/src/components/common/Pagination.tsx +++ b/src/components/common/Pagination.tsx @@ -15,7 +15,8 @@ const Pagination: FC = ({ viewQuerySettings, setViewQuerySettin const limit = userSettings.libraryPageSize(undefined); const totalRecordCount = itemsResult.TotalRecordCount || 0; const startIndex = viewQuerySettings.StartIndex || 0; - const recordsEnd = Math.min(startIndex + limit, totalRecordCount); + const recordsStart = totalRecordCount ? startIndex + 1 : 0; + const recordsEnd = limit ? Math.min(startIndex + limit, totalRecordCount) : totalRecordCount; const showControls = limit > 0 && limit < totalRecordCount; const element = useRef(null); @@ -69,25 +70,25 @@ const Pagination: FC = ({ viewQuerySettings, setViewQuerySettin return (
- {showControls && ( -
- - - {globalize.translate('ListPaging', (totalRecordCount ? startIndex + 1 : 0), recordsEnd, totalRecordCount)} - - - - -
- )} +
+ + {globalize.translate('ListPaging', recordsStart, recordsEnd, totalRecordCount)} + + {showControls && ( + <> + + + + )} +
); diff --git a/src/scripts/libraryBrowser.js b/src/scripts/libraryBrowser.js index eaec777401..0a44aaad36 100644 --- a/src/scripts/libraryBrowser.js +++ b/src/scripts/libraryBrowser.js @@ -81,16 +81,15 @@ export function getQueryPagingHtml (options) { const limit = options.limit; const totalRecordCount = options.totalRecordCount; let html = ''; - const recordsEnd = Math.min(startIndex + limit, totalRecordCount); - const showControls = limit < totalRecordCount; + const recordsStart = totalRecordCount ? startIndex + 1 : 0; + const recordsEnd = limit ? Math.min(startIndex + limit, totalRecordCount) : totalRecordCount; + const showControls = limit > 0 && limit < totalRecordCount; html += '
'; - if (showControls) { - html += ''; - html += globalize.translate('ListPaging', totalRecordCount ? startIndex + 1 : 0, recordsEnd, totalRecordCount); - html += ''; - } + html += ''; + html += globalize.translate('ListPaging', recordsStart, recordsEnd, totalRecordCount); + html += ''; if (showControls || options.viewButton || options.filterButton || options.sortButton || options.addLayoutButton) { html += '
';