Protect paginate against invalid values