diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/pager/Mini.php b/core/modules/views/lib/Drupal/views/Plugin/views/pager/Mini.php
index da66285..aa02a11 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/pager/Mini.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/pager/Mini.php
@@ -54,15 +54,16 @@ public function summaryTitle() {
    */
   public function query() {
     parent::query();
-
-    // Don't query for the next page if we have a pager that has a limited
-    // amount of pages.
-    if (empty($this->options['total_pages']) || ($this->getCurrentPage() < $this->options['total_pages'])) {
-      // Increase the items in the query in order to be able to find out whether
-      // there is another page.
-      $limit = $this->view->query->getLimit();
-      $limit += 1;
-      $this->view->query->setLimit($limit);
+    if ($this->getItemsPerPage() > 0) {
+      // Don't query for the next page if we have a pager that has a limited
+      // amount of pages.
+      if (empty($this->options['total_pages']) || ($this->getCurrentPage() < $this->options['total_pages'])) {
+        // Increase the items in the query in order to be able to find out whether
+        // there is another page.
+        $limit = $this->view->query->getLimit();
+        $limit += 1;
+        $this->view->query->setLimit($limit);
+      }
     }
   }
 
@@ -77,14 +78,16 @@ public function useCountQuery() {
    * Overrides \Drupal\views\Plugin\views\pager\PagerPluginBase::postExecute().
    */
   public function postExecute(&$result) {
-    // In query() one more item might have been retrieved than necessary. If so,
-    // the next link needs to be displayed and the item removed.
-    if (count($result) > $this->getItemsPerPage()) {
-      array_pop($result);
-      // Make sure the pager shows the next link by setting the total items to
-      // the biggest possible number but prevent failing calculations like
-      // ceil(PHP_INT_MAX) we take PHP_INT_MAX / 2.
-      pager_default_initialize(PHP_INT_MAX / 2, $this->getItemsPerPage(), $this->options['id']);
+    if ($this->getItemsPerPage() > 0) {
+      // In query() one more item might have been retrieved than necessary. If so,
+      // the next link needs to be displayed and the item removed.
+      if (count($result) > $this->getItemsPerPage()) {
+        array_pop($result);
+        // Make sure the pager shows the next link by setting the total items to
+        // the biggest possible number but prevent failing calculations like
+        // ceil(PHP_INT_MAX) we take PHP_INT_MAX / 2.
+        pager_default_initialize(PHP_INT_MAX / 2, $this->getItemsPerPage(), $this->options['id']);
+      }
     }
   }
 
