// system
     $template->assign_vars(array('S_ACTION' => append_sid($main_pgm), 'S_HIDDEN_FIELDS' => _hidden_get(), 'L_GOTO_PAGE' => $count < $board_config['topics_per_page'] ? '' : _lang('Goto_page'), 'PAGINATION' => $count < $board_config['topics_per_page'] ? '' : $page_list, 'PAGE_NUMBER' => $page_number));
     // send to browser
     privmsg_footer();
     $template->pparse('body');
     if (!defined('IN_PCP')) {
         include $phpbb_root_path . 'includes/page_tail.' . $phpEx;
     }
 } else {
     // display the page
     $page_title = _lang('Search_pm');
     if (!defined('IN_PCP')) {
         include $phpbb_root_path . 'includes/page_header.' . $phpEx;
     }
     $template->set_filenames(array('body' => 'privmsga_search_body.tpl'));
     privmsg_header($view_user_id, $folder_id, $privmsg_recip_id);
     // header
     $template->assign_vars(array('L_TITLE' => _lang('Search_pm'), 'L_SEARCH_FOLDER' => _lang('Search_folder'), 'L_SEARCH_FOLDER_EXPLAIN' => _lang('Search_folder_explain'), 'L_SEARCH_AUTHOR' => _lang('Search_recipient'), 'L_SEARCH_AUTHOR_EXPLAIN' => _lang('Search_recipient_explain'), 'L_SEARCH_WORDS' => _lang('Search_words'), 'L_SEARCH_WORDS_EXPLAIN' => _lang('Search_words_explain'), 'L_SUBMIT' => _lang('Submit'), 'L_CANCEL' => _lang('Cancel'), 'L_FIND_USERNAME' => _lang('Find_username'), 'U_SEARCH_USER' => append_sid("search.{$phpEx}?mode=searchuser")));
     // data
     $s_folders = '<option value="-1">' . _lang('All_folders') . '</option>' . get_folders_list(0, $folder_id);
     // vars
     $template->assign_vars(array('S_FOLDERS' => $s_folders, 'USERNAME' => empty($username) ? '' : str_replace("''", "'", $username), 'WORDS' => empty($search_words) ? '' : str_replace("''", "'", implode(', ', $search_words))));
     // system
     _hide(POST_USERS_URL, $view_user_id);
     _hide('pmmode', $pmmode);
     _hide('sid', $userdata['session_id']);
     $template->assign_vars(array('S_ACTION' => append_sid($main_pgm), 'S_HIDDEN_FIELDS' => _hidden_get()));
     // send to browser
     privmsg_footer();
     $template->pparse('body');
     if (!defined('IN_PCP')) {
                     }
                 }
             }
         }
         resync_pm($view_user_id);
     }
 }
 // set the page title and include the page header
 $page_title = _lang('Private_Messaging');
 if (!defined('IN_PCP')) {
     include $phpbb_root_path . 'includes/page_header.' . $phpEx;
 }
 // template name
 $template->set_filenames(array('body' => 'privmsga_body.tpl'));
 // send header
 privmsg_header($view_user_id, $folder_id);
 // send list
 privmsg_list($privmsg_rowset, $recips, $folder_id, true, $mark_ids);
 // pagination
 $page_list = generate_pagination("profile.{$phpEx}?mode=privmsg", $count_in_sub_folder, $board_config['topics_per_page'], $pm_start);
 $page_number = sprintf(_lang('Page_of'), floor($start / $board_config['topics_per_page']) + 1, ceil($count_in_sub_folder / $board_config['topics_per_page']));
 //$page_list      = str_replace('&amp;start', '&start', $page_list);
 $page_list = preg_replace("/\\&start\\=(\\d*)/", "javascript:document.post.start.value='\\1'; document.post.submit();", $page_list);
 // add marked on other pages
 for ($i = 0; $i < count($mark_ids); $i++) {
     if (empty($marked_on_this_page) || !in_array($mark_ids[$i], $marked_on_this_page)) {
         _hide('mark_ids[]', $mark_ids[$i]);
     }
 }
 _hide('start', $pm_start);
 _hide('pmmode', $pmmode);