diff --git a/module/VuFind/src/VuFind/Search/Base/Params.php b/module/VuFind/src/VuFind/Search/Base/Params.php
index 1fb493b4761f89f9d10968b4a8aca00ac55ec628..f3e1ae91e19420b7dd51c5973fc63f606c7341f5 100644
--- a/module/VuFind/src/VuFind/Search/Base/Params.php
+++ b/module/VuFind/src/VuFind/Search/Base/Params.php
@@ -512,14 +512,16 @@ class Params implements ServiceLocatorAwareInterface
     {
         // Check for a view parameter in the url.
         $view = $request->get('view');
-        $validViews = $this->getOptions()->getViewOptions();
+        $validViews = array_keys($this->getOptions()->getViewOptions());
         if ($view == 'rss') {
             // RSS is a special case that does not require config validation
             $this->setView('rss');
-        } else if (!empty($view) && in_array($view, array_keys($validViews))) {
+        } else if (!empty($view) && in_array($view, $validViews)) {
             // make sure the url parameter is a valid view
             $this->setView($view);
-        } else if (!empty($this->lastView)) {
+        } else if (!empty($this->lastView)
+            && in_array($this->lastView, $validViews)
+        ) {
             // if there is nothing in the URL, see if we had a previous value
             // injected based on session information.
             $this->setView($this->lastView);