/**
 * Force www.mysite.com/index.php to 301 redirect to www.mysite.com/
 * @uses defined()
 * @uses substr()
 * @uses strlen()
 */
function do_homepage_redirect($url = false)
{
    if (defined('USU5_HOME_PAGE_REDIRECT') && USU5_HOME_PAGE_REDIRECT == 'true' && USU5_ENABLED == 'true') {
        if (false === $url) {
            $original_request_uri = remove_querystring(Usu_Main::i()->getVar('original_request_uri'));
            $possible_file = substr($original_request_uri, strlen($original_request_uri) - strlen(FILENAME_DEFAULT), strlen(FILENAME_DEFAULT));
            if (!tep_not_null(Usu_Main::i()->getVar('request_uri')) && $possible_file == FILENAME_DEFAULT) {
                return true;
            }
        } else {
            $url = remove_querystring($url);
            $possible_file = substr($url, strlen($url) - strlen(FILENAME_DEFAULT), strlen(FILENAME_DEFAULT));
            if ($possible_file == FILENAME_DEFAULT) {
                return true;
            }
        }
    }
    return false;
}
	<input class="button-primary cfm_bottonWidth" id="submit_em"
				style="cursor: pointer; margin-top:10px; margin-bottom:10px;" type="button"
				name="textFieldButton2" value="Create Campaign"
				 onClick='document.location.href="<?php 
echo admin_url('admin.php?page=newsletter-manager-manage-campaigns&action=create_campaign');
?>
"'>
	<?php 
$total = $wpdb->get_var("SELECT COUNT(`id`) FROM " . $wpdb->prefix . "xyz_em_email_campaign");
$num_of_pages = ceil($total / $limit);
function remove_querystring($url)
{
    $xyz_em_messageReplacedUrl = preg_replace('/&campmsg(=[^&]*)?|^campmsg(=[^&]*)?&?/', '', $url);
    return $xyz_em_messageReplacedUrl;
}
$page_links = paginate_links(array('base' => remove_querystring(add_query_arg('pagenum', '%#%')), 'format' => '', 'prev_text' => '&laquo;', 'next_text' => '&raquo;', 'total' => $num_of_pages, 'current' => $pagenum));
if ($page_links) {
    echo '<div class="tablenav"><div class="tablenav-pages" style="margin: 1em 0">' . $page_links . '</div></div>';
}
echo '</div>';
?>


</div>
<?php 
function get_attachment($campId)
{
    global $wpdb;
    echo $wpdb->query($wpdb->prepare("SELECT * FROM " . $wpdb->prefix . "xyz_em_attachment WHERE campaigns_id= %d", $campId));
}
function get_remaining_count($listId, $lastSentMappingId, $joinAfterCampaignStarted, $campStartTime)
				style="cursor: pointer; margin-top:10px; margin-bottom:10px;" type="button"
				name="textFieldButton2" value="Add Email Address"
				 onClick='document.location.href="<?php 
echo admin_url('admin.php?page=newsletter-manager-manage-emails&action=add_emails');
?>
"'>
	<?php 
//  $wpdb->query('ANALYZE TABLE '.$wpdb->prefix.'xyz_em_email_address');
// 	$total1 = $wpdb->get_results( 'SHOW TABLE STATUS WHERE name="'.$wpdb->prefix.'xyz_em_email_address"') ;
// 	$total1 = $total1[0];
// 	$num_of_pages = ceil( $total1->Rows / $limit );
//$total = $wpdb->get_var( "SELECT COUNT(`id`) FROM ".$wpdb->prefix."xyz_em_email_address" );
//$num_of_pages = ceil( $total / $limit );
$total = $wpdb->get_var("SELECT COUNT(`ea_id`) FROM " . $wpdb->prefix . "xyz_em_address_list_mapping {$count_str}");
$num_of_pages = ceil($total / $limit);
function remove_querystring($url)
{
    $xyz_em_messageReplacedUrl = preg_replace('/&emailmsg(=[^&]*)?|^emailmsg(=[^&]*)?&?/', '', $url);
    return $xyz_em_messageReplacedUrl;
}
$page_links = paginate_links(array('base' => remove_querystring(add_query_arg(array('pagenum' => '%#%', 'xyz_em_email_address_status' => $xyz_em_email_address_status))), 'format' => '', 'prev_text' => '&laquo;', 'next_text' => '&raquo;', 'total' => $num_of_pages, 'current' => $pagenum));
//echo "pppp:".remove_querystring_var(add_query_arg( 'pagenum','%#%'),"emailmsg");
if ($page_links) {
    echo '<div class="tablenav"><div class="tablenav-pages" style="margin: 1em 0">' . $page_links . '</div></div>';
}
echo '</div>';
?>

</div>