summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-08-11 19:51:53 +0200
committerAleksander Machniak <alec@alec.pl>2012-08-11 19:53:39 +0200
commit002d1a44e4065b89602dd293551d59c66845fd52 (patch)
tree0ba4b2eb6c902c00b9996dd9a1e168396722b37a /program
parent3d8eef31c2b4c52159ea1791b08da8db008ea12e (diff)
Fix wrong search result on servers without SORT support
Diffstat (limited to 'program')
-rw-r--r--program/include/rcube_imap.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 205278963..6b8cc2971 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -1015,8 +1015,8 @@ class rcube_imap extends rcube_storage
$a_msg_headers, $this->sort_field, $this->sort_order);
// only return the requested part of the set
- $a_msg_headers = array_slice(array_values($a_msg_headers),
- $from, min($cnt-$to, $this->page_size));
+ $slice_length = min($this->page_size, $cnt - ($to > $cnt ? $from : $to));
+ $a_msg_headers = array_slice(array_values($a_msg_headers), $from, $slice_length);
if ($slice) {
$a_msg_headers = array_slice($a_msg_headers, -$slice, $slice);