Code Room
Code reviewMediumcr-g365
Subject Pagination bugsLevel Mid–Senior~20 minCommon in Networking & APIs interviewsIndustries Software development, IT services

Question

Review this Java paginated ticket-list endpoint that returns a total page count the UI uses to render page buttons.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewjava
@GetMapping("/tickets")public PageDto list(@RequestParam int page, @RequestParam(defaultValue="25") int size) {    long total = repo.count();                      // SELECT COUNT(*)    int totalPages = (int) (total / size);          // for the UI pager    List<Ticket> items = repo.findPage(page, size); // OFFSET page*size    return new PageDto(items, page, totalPages, total);}
Run or narrate your approach, then ask the coach.