diff --git a/src/Plugin/ProjectBrowserSource/Recipes.php b/src/Plugin/ProjectBrowserSource/Recipes.php
index cfcab182c1889f92086b8fd0a713bc6c211a82a5..ce376456210f102177c2a980ca9e940d5aa4b3f3 100644
--- a/src/Plugin/ProjectBrowserSource/Recipes.php
+++ b/src/Plugin/ProjectBrowserSource/Recipes.php
@@ -115,8 +115,6 @@ class Recipes extends ProjectBrowserSourceBase {
       $this->cacheBin->set($this->getPluginId(), $projects);
     }
 
-    $total = count($projects);
-
     // Filter by project machine name.
     if (!empty($query['machine_name'])) {
       $projects = array_filter($projects, fn(Project $project) => $project->machineName === $query['machine_name']);
@@ -137,6 +135,8 @@ class Recipes extends ProjectBrowserSourceBase {
       $projects = array_filter($projects, fn(Project $project) => stripos($project->title, $query['search']) !== FALSE);
     }
 
+    $total = count($projects);
+
     // Filter by sorting criterion.
     if (!empty($query['sort'])) {
       $sort = $query['sort'];