<?php
/**
 * Loaded Counter Template
 * 
 * This template displays the count of loaded properties.
 * 
 * HOW TO OVERRIDE THIS TEMPLATE:
 * 1. Copy this file from: wp-content/plugins/havenlytics/templates/search/loaded-counter.php
 * 2. Paste it to your theme at: wp-content/themes/your-theme/havenlytics/search/loaded-counter.php
 * 3. Modify the copied file to customize the loaded counter display
 * 
 * @package     Havenlytics
 * @subpackage  Templates/search
 * @since       2.0.0
 */

if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}

global $wp_query;

// Prefix all variables with hvnly_ to avoid global namespace conflicts
$hvnly_current_page = max(1, get_query_var('paged'));
$hvnly_per_page = $wp_query->get('posts_per_page');
$hvnly_loaded_count = min($hvnly_current_page * $hvnly_per_page, $wp_query->found_posts);
$hvnly_total_count = $wp_query->found_posts;
?>
<div class="hvnly-property-load-more-info">
    <span id="loadedCount"><?php echo esc_html($hvnly_loaded_count); ?></span>
    <?php esc_html_e('of', 'havenlytics'); ?>
    <span id="totalCount"><?php echo esc_html($hvnly_total_count); ?></span>
    <?php esc_html_e('properties loaded', 'havenlytics'); ?>
</div>