diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-08-21 10:59:48 +0100 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-08-21 10:59:48 +0100 |
commit | b8ed99e84120c561bfc9650144c26c5ccada4939 (patch) | |
tree | dd9a5c2576da929dad5f14fe9f7a99340f8ef908 /app/controllers/application_controller.rb | |
parent | 396b272c7f77ffe94ec5efb112e88a3c384d2db0 (diff) |
Don't pass a page param of less than one through to Xapian, treat it as a param of 1. Fixes #557.
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7b5eb5590..ce18e6ef5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -134,10 +134,10 @@ class ApplicationController < ActionController::Base # Make sure expiry time for session is set (before_filters are # otherwise missed by this override) session_remember_me - + # Make sure the locale is set correctly too set_gettext_locale - + case exception when ActiveRecord::RecordNotFound, ActionController::UnknownAction, ActionController::RoutingError @status = 404 @@ -392,8 +392,11 @@ class ApplicationController < ActionController::Base # might fail later if the database has subsequently been reopened. return result end + def get_search_page_from_params - return (params[:page] || "1").to_i + page = (params[:page] || "1").to_i + page = 1 if page < 1 + return page end def perform_search_typeahead(query, model) |