diff --git a/include/class.client.php b/include/class.client.php
index 886c893424c0ca09540325ccb913fdba86026673..e7d5adecf8c0381bd6f927b796586d5828909c2a 100644
--- a/include/class.client.php
+++ b/include/class.client.php
@@ -253,7 +253,6 @@ class  EndUser extends BaseAuthenticatedUser {
 
     function getNumTopicTickets($topic_id, $forMyOrg=false) {
         $stats = $this->getTicketStats();
-        $count = 0;
         $section = $forMyOrg ? 'myorg' : 'mine';
         if (!isset($this->topic_stats)) {
             $this->topic_stats = array();
@@ -264,6 +263,20 @@ class  EndUser extends BaseAuthenticatedUser {
         return $this->topic_stats[$topic_id];
     }
 
+    function getNumTopicTicketsInState($topic_id, $state=false, $forMyOrg=false) {
+        $stats = $this->getTicketStats();
+        $count = 0;
+        $section = $forMyOrg ? 'myorg' : 'mine';
+        foreach ($stats[$section] as $row) {
+            if ($topic_id != $row['topic_id'])
+                continue;
+            if ($state && $state != $row['status__state'])
+                continue;
+            $count += $row['count'];
+        }
+        return $count;
+    }
+
     function getNumOrganizationTickets() {
         return $this->getNumTickets(true);
     }
diff --git a/include/client/tickets.inc.php b/include/client/tickets.inc.php
index 12908ece25e65bc1f0240ca6ca88522973a01744..dfc7673e0eef4553bfbda85b321a9948f6d33806 100644
--- a/include/client/tickets.inc.php
+++ b/include/client/tickets.inc.php
@@ -6,12 +6,28 @@ $settings = &$_SESSION['client:Q'];
 // Unpack search, filter, and sort requests
 if (isset($_REQUEST['clear']))
     $settings = array();
-if (isset($_REQUEST['keywords']))
+if (isset($_REQUEST['keywords'])) {
     $settings['keywords'] = $_REQUEST['keywords'];
-if (isset($_REQUEST['topic_id']))
+}
+if (isset($_REQUEST['topic_id'])) {
     $settings['topic_id'] = $_REQUEST['topic_id'];
-if (isset($_REQUEST['status']))
+}
+if (isset($_REQUEST['status'])) {
     $settings['status'] = $_REQUEST['status'];
+}
+
+if ($settings['keywords']) {
+    // Don't show stat counts for searches
+    $openTickets = $closedTickets = -1;
+}
+elseif ($settings['topic_id']) {
+    $openTickets = $thisclient->getNumTopicTicketsInState($settings['topic_id'], 'open');
+    $closedTickets = $thisclient->getNumTopicTicketsInState($settings['topic_id'], 'closed');
+}
+else {
+    $openTickets = $thisclient->getNumOpenTickets();
+    $closedTickets = $thisclient->getNumClosedTickets();
+}
 
 $tickets = TicketModel::objects();
 
@@ -136,19 +152,25 @@ $tickets->values(
 
 <div class="pull-right states">
     <small>
+<?php if ($openTickets) { ?>
     <i class="icon-file-alt"></i>
     <a class="state <?php if ($status == 'open') echo 'active'; ?>"
         href="?<?php echo Http::build_query(array('a' => 'search', 'status' => 'open')); ?>">
-    <?php echo sprintf('%s (%d)', _P('ticket-status', 'Open'), $thisclient->getNumOpenTickets()); ?>
+    <?php echo _P('ticket-status', 'Open'); if ($openTickets > 0) echo sprintf(' (%d)', $openTickets); ?>
     </a>
+    <?php if ($closedTickets) { ?>
     &nbsp;
     <span style="color:lightgray">|</span>
+    <?php }
+}
+if ($closedTickets) {?>
     &nbsp;
     <i class="icon-file-text"></i>
     <a class="state <?php if ($status == 'closed') echo 'active'; ?>"
         href="?<?php echo Http::build_query(array('a' => 'search', 'status' => 'closed')); ?>">
-    <?php echo sprintf('%s (%d)', __('Closed'), $thisclient->getNumClosedTickets()); ?>
+    <?php echo __('Closed'); if ($closedTickets > 0) echo sprintf(' (%d)', $closedTickets); ?>
     </a>
+<?php } ?>
     </small>
 </div>
 </h1>