fix pagination

This commit is contained in:
Anton Romanov 2021-04-05 15:07:08 +04:00
parent ddd5bc504e
commit 68c0f597ca

View File

@ -46,10 +46,10 @@ public class GitFilteringController {
Page<Commit> commitsPage = filteringService.getCommits(repositoryUrl, Page<Commit> commitsPage = filteringService.getCommits(repositoryUrl,
branchName, branchName,
new OffsetablePageRequest(currentPage, pageSize)); new OffsetablePageRequest(currentPage - 1, pageSize));
int totalPages = commitsPage.getTotalPages(); int totalPages = commitsPage.getTotalPages();
if (totalPages > 0) { if (totalPages > 0) {
List<Integer> pageNumbers = IntStream.rangeClosed(1, totalPages - 1) List<Integer> pageNumbers = IntStream.rangeClosed(1, totalPages)
.boxed() .boxed()
.collect(Collectors.toList()); .collect(Collectors.toList());
model.addAttribute("pageNumbers", pageNumbers); model.addAttribute("pageNumbers", pageNumbers);