Fix pagination issues including off-by-one errors and missing data
Help me debug pagination issues in my application.
**Pagination type:** {{PAGINATION_TYPE}}
**Backend code:**
```{{LANGUAGE}}
{{BACKEND_CODE}}
```
**Frontend code:**
```{{FRONTEND_LANGUAGE}}
{{FRONTEND_CODE}}
```
**Database query:**
```sql
{{QUERY}}
```
**Problem:** {{PROBLEM}}
**Total items:** {{TOTAL}}
**Page size:** {{PAGE_SIZE}}
**Current page:** {{CURRENT_PAGE}}
Please provide:
1. **Offset Calculation**: Check offset/limit calculations
2. **Off-by-One**: Identify off-by-one errors
3. **Duplicate/Missing Items**: Why items are duplicated or missing
4. **Cursor-Based Fix**: Consider cursor-based pagination
5. **Fixed Code**: Corrected pagination implementation
6. **Total Count**: Proper total count calculation
7. **Edge Cases**: Handle first/last page edge cases
8. **Performance**: Optimize for large datasetsOr press ⌘C to copy
Replace these placeholders with your own content before using the prompt.
[{PAGINATION_TYPE][{LANGUAGE][{BACKEND_CODE][{FRONTEND_LANGUAGE][{FRONTEND_CODE][{QUERY][{PROBLEM][{TOTAL][{PAGE_SIZE][{CURRENT_PAGE]