Limit number of pages in will_paginate
So, when using Sphinx searches are limited to 1000 results. But, if there are more than 1000 results pagination links generated by will_paginate don't take this into account, and provide links to pages beyond 1000/per_page . Is the an obvious way setting a max pages or something similar? Cheers. I think it's better to submit the parameter :total_entries to method paginate : @posts = Post.paginate(:page => params[:page], :per_page => 30, :total_entries => 1000) will_paginate will generate links only for the number of pages needed to show 1000 results. You can also verify that the requested page