Fix a small bug when displaying less messages than the page max.
[squirrelmail.git] / functions / mailbox_display.php
index adf6b5efb25687ebc9aadaad88fb228b3058c049..4a58d6dacaa9177d04751a746bc960d5029741bf 100644 (file)
@@ -899,6 +899,7 @@ function showMessagesForMailbox($imapConnection, &$aMailbox,$aProps, &$iError) {
              $aMailbox['PAGEOFFSET'] + $iLimit - 1 : $aMailbox['EXISTS'];
 
     $iNumberOfMessages = $aMailbox['TOTAL'][$iSetIndx];
+    $iEnd = min ( $iEnd, $iNumberOfMessages );
 
     $php_self = $PHP_SELF;
 
@@ -1377,4 +1378,4 @@ function attachSelectedMessages($imapConnection,$aMsgHeaders) {
     return $composesession;
 }
 
-?>
\ No newline at end of file
+?>