Use the count of what we found, not what is in the actual mailbox
[squirrelmail.git] / src / search.php
index e37c467ba858d6c280de692ac87976eb97ec311e..7d276868a57410750c5c339e1be404d3e2e15222 100644 (file)
@@ -878,8 +878,8 @@ function asearch_print_mailbox_msgs($imapConnection, &$aMailbox, $color) {
     $cnt = count($aMailbox['UIDSET'][$iSetIndx]);
 
     $iLimit = ($aMailbox['SHOWALL'][$iSetIndx]) ? $cnt : $aMailbox['LIMIT'];
-    $iEnd = ($aMailbox['PAGEOFFSET'] + ($iLimit - 1) < $aMailbox['EXISTS']) ?
-            $aMailbox['PAGEOFFSET'] + $iLimit - 1 : $cnt;
+    $iEnd = ($aMailbox['PAGEOFFSET'] + ($iLimit - 1) < $cnt) ?
+            $aMailbox['PAGEOFFSET'] + ($iLimit - 1) : $cnt;
 
     $paginator_str = get_paginator_str($aMailbox['NAME'], $aMailbox['PAGEOFFSET'],
                                     $cnt, $aMailbox['LIMIT'], $aMailbox['SHOWALL'][$iSetIndx]);
@@ -1493,4 +1493,4 @@ do_hook('search_bottom');
 sqimap_logout($imapConnection);
 echo '</body></html>';
 sqsession_register($mailbox_cache,'mailbox_cache');
-?>
\ No newline at end of file
+?>