if (empty($GLOBAL_CONFIG['pagin_personell_search_max_block_rows'])) {
    $pagen->setMaxCount(MAX_BLOCK_ROWS);
} else {
    $pagen->setMaxCount($GLOBAL_CONFIG['pagin_personell_search_max_block_rows']);
}
# Load date formatter
require_once $root_path . 'include/inc_date_format_functions.php';
# Check mode
if ($mode == 'search' || $mode == 'paginate') {
    # Convert other wildcards
    $searchkey = strtr($searchkey, '*?', '%_');
    # Save the search keyword for eventual pagination routines
    if ($mode == 'search') {
        $_SESSION['sess_searchkey'] = $searchkey;
    }
    $search_result =& $pers_obj->searchLimitPersonellBasicInfo($searchkey, $pagen->MaxCount(), $pgx, $oitem, $odir);
    //echo $pers_obj->getLastQuery();
    # Get the resulting record count
    $linecount = $pers_obj->LastRecordCount();
    //$linecount=$address_obj->LastRecordCount();
    $pagen->setTotalBlockCount($linecount);
    # Count total available data
    if (isset($totalcount) && $totalcount) {
        $pagen->setTotalDataCount($totalcount);
    } else {
        @$pers_obj->searchPersonellBasicInfo($searchkey, '');
        # The second param is empty to prevent sorting
        $totalcount = $pers_obj->LastRecordCount();
        $pagen->setTotalDataCount($totalcount);
    }
    $pagen->setSortItem($oitem);