<?php

// Prevent direct access
if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

// phpcs:disable WordPress.Security.NonceVerification.Recommended -- This is legitimate pagination navigation for admin pages, not form processing
?>
<div class="container-fluid unify-table-pagination p-0">
	<div class="row">
		<div class="col">
			<ul class="pagination">
				<li  class="<?php echo ($prev_dis) ? 'disabled' : ''; ?>">
					<a href="<?php 
					// phpcs:ignore WordPress.Security.NonceVerification.Recommended
					echo (($prev_dis) ? 'javascript:void(0)' : (!empty($_GET['paged']) ? esc_html(str_replace('paged=' . esc_html($paged), "paged=" . (esc_html($paged) - 1), esc_html(add_query_arg( NULL, NULL )))) :  esc_html(add_query_arg( NULL, NULL )). "&paged=" . (esc_html($paged) - 1))); ?>" >
						Prev
					</a>
				</li>
				<?php
				for ($unify_i = 1; $unify_i <= $total; $unify_i++)
				{
					if($unify_i < 3 || ($total - 2) < $unify_i || $total < 7 || ($paged + 1) == $unify_i || ($paged - 1) == $unify_i || $paged == $unify_i)
					{
					?>				
					<li class="<?php echo (($paged == $unify_i) ? 'active' : '') ?>" >
						<a href="<?php echo (!empty($_GET['paged']) ? esc_html(str_replace('paged=' . esc_html($paged), "paged=" . esc_html($unify_i), esc_html(add_query_arg( NULL, NULL )))) :  esc_html(add_query_arg( NULL, NULL )). "&paged=" .esc_html($unify_i)); ?>" >
							<?php echo esc_html($unify_i); ?>
						</a>
					</li>
				<?php 				
					}
				}
					?>
				<li  class="<?php echo ($next_dis) ? 'disabled' : ''; ?>">
					<a href="<?php 
					// phpcs:ignore WordPress.Security.NonceVerification.Recommended
					echo (($next_dis) ? 'javascript:void(0)' : (!empty($_GET['paged']) ? esc_html(str_replace('paged=' . esc_html($paged), "paged=" . (esc_html($paged) + 1), esc_html(add_query_arg( NULL, NULL )))) :  esc_html(add_query_arg( NULL, NULL )). "&paged=" . (esc_html($paged) + 1))); ?>" >
						Next
					</a>
				</li>
			</ul>
		</div>
	</div>
</div>
<?php
// phpcs:enable WordPress.Security.NonceVerification.Recommended
?>