+ // get records from the next page to add to the list
+ $pages = ceil(($result->count + $delcnt) / $CONFIG['pagesize']);
+ if ($_GET['_from'] != 'show' && $pages > 1 && $page < $pages) {
+ $CONTACTS->set_page($page);
+ $records = $CONTACTS->list_records(null, -$delcnt);
+ }
+}
+
+// update message count display
+$OUTPUT->set_env('pagecount', ceil($result->count / $CONFIG['pagesize']));
+$OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result));
+
+if (!empty($_SESSION['contact_undo'])) {
+ $_SESSION['contact_undo']['ts'] = time();
+ $msg = html::span(null, rcube_label('contactdeleted'))
+ . ' ' . html::a(array('onclick' => JS_OBJECT_NAME.".command('undo', '', this)"), rcube_label('undo'));
+
+ $OUTPUT->show_message($msg, 'confirmation', null, true, $undo_time);
+}
+else {
+ $OUTPUT->show_message('contactdeleted', 'confirmation');
+}
+
+// add new rows from next page (if any)
+if (!empty($records)) {
+ rcmail_js_contacts_list($records);
+}