Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / views / src / Plugin / views / pager / PagerPluginBase.php
index ec231a0b08c4f2f190f63e1ccb7c1a753d7da4dc..52f4393d1575a34a486195522f77e0cd1cc5513d 100644 (file)
@@ -114,12 +114,12 @@ abstract class PagerPluginBase extends PluginBase {
   /**
    * Provide the default form form for validating options
    */
-  public function validateOptionsForm(&$form, FormStateInterface $form_state) { }
+  public function validateOptionsForm(&$form, FormStateInterface $form_state) {}
 
   /**
    * Provide the default form form for submitting options
    */
-  public function submitOptionsForm(&$form, FormStateInterface $form_state) { }
+  public function submitOptionsForm(&$form, FormStateInterface $form_state) {}
 
   /**
    * Return a string to display as the clickable title for the
@@ -156,6 +156,8 @@ abstract class PagerPluginBase extends PluginBase {
     if (!empty($this->options['offset'])) {
       $this->total_items -= $this->options['offset'];
     }
+    // Prevent from being negative.
+    $this->total_items = max(0, $this->total_items);
 
     return $this->total_items;
   }
@@ -173,22 +175,22 @@ abstract class PagerPluginBase extends PluginBase {
    *
    * This is called during the build phase and can directly modify the query.
    */
-  public function query() { }
+  public function query() {}
 
   /**
    * Perform any needed actions just prior to the query executing.
    */
-  public function preExecute(&$query) { }
+  public function preExecute(&$query) {}
 
   /**
    * Perform any needed actions just after the query executing.
    */
-  public function postExecute(&$result) { }
+  public function postExecute(&$result) {}
 
   /**
    * Perform any needed actions just before rendering.
    */
-  public function preRender(&$result) { }
+  public function preRender(&$result) {}
 
   /**
    * Return the renderable array of the pager.
@@ -199,7 +201,7 @@ abstract class PagerPluginBase extends PluginBase {
    *   Any extra GET parameters that should be retained, such as exposed
    *   input.
    */
-  public function render($input) { }
+  public function render($input) {}
 
   /**
    * Determine if there are more records available.
@@ -211,11 +213,11 @@ abstract class PagerPluginBase extends PluginBase {
       && $this->total_items > (intval($this->current_page) + 1) * $this->getItemsPerPage();
   }
 
-  public function exposedFormAlter(&$form, FormStateInterface $form_state) { }
+  public function exposedFormAlter(&$form, FormStateInterface $form_state) {}
 
-  public function exposedFormValidate(&$form, FormStateInterface $form_state) { }
+  public function exposedFormValidate(&$form, FormStateInterface $form_state) {}
 
-  public function exposedFormSubmit(&$form, FormStateInterface $form_state, &$exclude) { }
+  public function exposedFormSubmit(&$form, FormStateInterface $form_state, &$exclude) {}
 
   public function usesExposed() {
     return FALSE;