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,
branchName,
new OffsetablePageRequest(currentPage, pageSize));
new OffsetablePageRequest(currentPage - 1, pageSize));
int totalPages = commitsPage.getTotalPages();
if (totalPages > 0) {
List<Integer> pageNumbers = IntStream.rangeClosed(1, totalPages - 1)
List<Integer> pageNumbers = IntStream.rangeClosed(1, totalPages)
.boxed()
.collect(Collectors.toList());
model.addAttribute("pageNumbers", pageNumbers);