<?php
	class Hotel_26_pagination {
		function Hotel_26_page($curpage, $post_type_data) {
?>
<div class="col-12 text-center mt-lg-5 wow fadeIn" data-wow-delay="0ms" data-wow-duration="1500ms">	
	
	<?php if($post_type_data->max_num_pages > 1) { 
		?>
	<nav class="navigation pagination" aria-label="Posts">
		<h2 class="screen-reader-text"><?php esc_html_e('Posts Navigation','hotel-26'); ?></h2>
		<div class="nav-links">
		<?php
			$total_pages = $post_type_data->max_num_pages;
			$range = 1; // show 1 page before and after current
			$show_items = ($range * 2) + 1;

			if ($total_pages > 1) {
				// Previous arrow
				if ($curpage > 1) {
					echo '<a class="prev page-numbers" href="' . get_pagenum_link($curpage - 1) . '"><i class="fa fa-angle-left"></i></a>';
				}

				// First page
				if ($curpage > ($range + 2)) {
					echo '<a class="page-numbers" href="' . get_pagenum_link(1) . '">1</a>';
					echo '<span class="page-numbers dots">…</span>';
				}

				// Middle pages (current - 1 to current + 1)
				for ($i = max(1, $curpage - $range); $i <= min($total_pages, $curpage + $range); $i++) {
					if ($i == $curpage) {
						echo '<a class="page-numbers active" href="' . get_pagenum_link($i) . '">' . $i . '</a>';
					} else {
						echo '<a class="page-numbers" href="' . get_pagenum_link($i) . '">' . $i . '</a>';
					}
				}

				// Last page
				if ($curpage < ($total_pages - ($range + 1))) {
					echo '<span class="page-numbers dots">…</span>';
					echo '<a class="page-numbers" href="' . get_pagenum_link($total_pages) . '">' . $total_pages . '</a>';
				}

				// Next arrow
				if ($curpage < $total_pages) {
					echo '<a class="next page-numbers" href="' . get_pagenum_link($curpage + 1) . '"><i class="fa fa-angle-right"></i></a>';
				}
			}
			?>

		</div>
	</nav>
	<?php }	?>
</div>
<?php } } ?>