diff --git a/plugins/archive/archive.php b/plugins/archive/archive.php index 7bfb985e40f..f0a291b0520 100644 --- a/plugins/archive/archive.php +++ b/plugins/archive/archive.php @@ -291,8 +291,11 @@ function move_messages() // add new rows from next page (if any) if ($addrows && $count && $uids != '*' && ($jump_back || $nextpage_count > 0)) { + // #5862: Don't add more rows than it was on the next page + $count = $jump_back ? null : min($nextpage_count, $count); + $a_headers = $storage->list_messages($mbox, null, - rcmail_sort_column(), rcmail_sort_order(), $jump_back ? null : $count); + rcmail_sort_column(), rcmail_sort_order(), $count); rcmail_js_message_list($a_headers, false); } diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc index 50665e14ed3..215722169b6 100644 --- a/program/steps/mail/mark.inc +++ b/program/steps/mail/mark.inc @@ -158,8 +158,11 @@ if ($_uids && $flag) { // add new rows from next page (if any) if ($old_count && $_uids != '*' && ($jump_back || $nextpage_count > 0)) { - $a_headers = $RCMAIL->storage->list_messages($mbox, NULL, - rcmail_sort_column(), rcmail_sort_order(), $jump_back ? NULL : $count); + // #5862: Don't add more rows than it was on the next page + $count = $jump_back ? null : min($nextpage_count, $count); + + $a_headers = $RCMAIL->storage->list_messages($mbox, null, + rcmail_sort_column(), rcmail_sort_order(), $count); rcmail_js_message_list($a_headers, false); }