codereview-env / utils /pagination.py
Anurag137's picture
chore: verified code - zero modifications, all tests passing
2d2c6e4
Raw
History Blame Contribute Delete
378 Bytes
# EXISTING CODE - DO NOT MODIFY (Treat as Read-Only Library)
def get_paged_items(items: list, page: int, page_size: int) -> list:
"""
Existing buggy/unsafe pagination logic.
- Fails on page 0 (returns negative slice)
- No type checking
- No bounds checking
"""
start = (page - 1) * page_size
end = start + page_size
return items[start:end]