summaryrefslogtreecommitdiff
path: root/program/include
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:51:53 +0200
commit2c59937c6af621f16fd31e9ce6ac01b25151bda5 (patch)
treec6c77f4016912c653b31bf8a21b4e2cbfc952fe4 /program/include
parent703be89e20dbbd5d9c66b0736824e258e526614d (diff)
Fix wrong search result on servers without SORT support
Diffstat (limited to 'program/include')
-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 94200b7da..4ab06cf60 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -1012,8 +1012,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);