```python
current_page = max(current_page, 0)
current_page = min(current_page, final_page)
```