Refactored code in books_controller
Implemented pagination for book search