Corrected type issues in search results pagination, and refactored slightly for clarity.