diff --git a/core/modules/views/views.tokens.inc b/core/modules/views/views.tokens.inc
index 59faec3..7c7e2ab 100644
--- a/core/modules/views/views.tokens.inc
+++ b/core/modules/views/views.tokens.inc
@@ -113,7 +113,7 @@ function views_tokens($type, $tokens, array $data, array $options, BubbleableMet
           $replacements[$original] = $view->storage->get('base_field');
           break;
         case 'total-rows':
-          $replacements[$original] = count($view->result);
+          $replacements[$original] = $view->total_rows;
           break;
         case 'items-per-page':
           $replacements[$original] = (int) $view->getItemsPerPage();
