<?php $pagenum = isset($_GET['pn']) ? (int) $_GET['pn'] : 1; $limit = SG_APP_POPUP_TABLE_LIMIT; $offset = ($pagenum - 1) * $limit; $total = SGPopup::getTotalRowCount(); $num_of_pages = ceil(esc_html($total) / $limit); if ($pagenum > $num_of_pages || $pagenum < 1) { $offset = 0; $pagenum = 1; } $orderBy = 'id DESC'; $entries = SGPopup::findAll($orderBy, $limit, $offset); ?> <div class="wrap"> <div class="headers-wrapper"> <h2>Popups <a href="<?php echo admin_url(); ?> admin.php?page=create-popup" class="add-new-h2">Add New</a></h2> <?php if (!SG_POPUP_PRO) { ?> <input type="button" class="main-update-to-pro" value="Upgrade to PRO version" onclick="window.open('<?php echo SG_POPUP_PRO_URL; ?> ')"> <?php } ?> </div>