fixes #5773 - redirect to referrer URL that includes page and search

previously, only `puppetclasses_controller` used this method, so I moved it to `application_controller` to be used by `filters_controller` and possibly others.