diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
index b09320c..abef619 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/DisplayPluginBase.php
@@ -216,7 +216,7 @@ public function isDefaultDisplay() { return FALSE; }
   public function usesExposed() {
     if (!isset($this->has_exposed)) {
       foreach ($this->handlers as $type => $value) {
-        foreach ($this->view->$type as $id => $handler) {
+        foreach ($this->view->$type as $handler) {
           if ($handler->canExpose() && $handler->isExposed()) {
             // one is all we need; if we find it, return true.
             $this->has_exposed = TRUE;
@@ -365,7 +365,7 @@ public function acceptAttachments() {
     }
 
     if (!empty($this->view->argument) && $this->getOption('hide_attachment_summary')) {
-      foreach ($this->view->argument as $argument_id => $argument) {
+      foreach ($this->view->argument as $argument) {
         if ($argument->needsStylePlugin() && empty($argument->argument_validated)) {
           return FALSE;
         }
@@ -1022,17 +1022,16 @@ public function getArgumentsTokens() {
     if (!empty($this->view->build_info['substitutions'])) {
       $tokens = $this->view->build_info['substitutions'];
     }
-    $count = 0;
-    foreach ($this->view->display_handler->getHandlers('argument') as $arg => $handler) {
-      $token = '%' . ++$count;
-      if (!isset($tokens[$token])) {
-        $tokens[$token] = '';
-      }
 
+    // Add tokens for every argument (contextual filter) and path arg.
+    for ($count=1; $count <= count($this->view->display_handler->getHandlers('argument')); $count++) {
+      if (!isset($tokens["%$count"])) {
+        $tokens["%$count"] = '';
+      }
       // Use strip tags as there should never be HTML in the path.
       // However, we need to preserve special characters like " that
       // were removed by check_plain().
-      $tokens['!' . $count] = isset($this->view->args[$count - 1]) ? strip_tags(decode_entities($this->view->args[$count - 1])) : '';
+      $tokens["!$count"] = isset($this->view->args[$count - 1]) ? strip_tags(decode_entities($this->view->args[$count - 1])) : '';
     }
 
     return $tokens;
@@ -1121,8 +1120,6 @@ public function optionsSummary(&$categories, &$options) {
     $style_summary = empty($style_plugin_instance->definition['title']) ? t('Missing style plugin') : $style_plugin_instance->summaryTitle();
     $style_title = empty($style_plugin_instance->definition['title']) ? t('Missing style plugin') : $style_plugin_instance->pluginTitle();
 
-    $style = '';
-
     $options['style'] = array(
       'category' => 'format',
       'title' => t('Format'),
@@ -1586,7 +1583,7 @@ public function buildOptionsForm(&$form, &$form_state) {
         $entities = entity_get_info();
         $entity_tables = array();
         $has_translation_handlers = FALSE;
-        foreach ($entities as $type => $entity_info) {
+        foreach ($entities as $entity_info) {
           $entity_tables[] = $entity_info['base_table'];
 
           if (!empty($entity_info['translation'])) {
@@ -1701,7 +1698,7 @@ public function buildOptionsForm(&$form, &$form_state) {
 
         $options = array();
         $count = 0; // This lets us prepare the key as we want it printed.
-        foreach ($this->view->display_handler->getHandlers('argument') as $arg => $handler) {
+        foreach ($this->view->display_handler->getHandlers('argument') as $handler) {
           $options[t('Arguments')]['%' . ++$count] = t('@argument title', array('@argument' => $handler->adminLabel()));
           $options[t('Arguments')]['!' . $count] = t('@argument input', array('@argument' => $handler->adminLabel()));
         }
@@ -2092,7 +2089,6 @@ protected function formatThemes($themes) {
     $registry = $this->theme_registry;
     $extension = $this->theme_extension;
 
-    $output = '';
     $picked = FALSE;
     foreach ($themes as $theme) {
       $template = strtr($theme, '_', '-') . $extension;
