<?php

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

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

// Extract the passed variables
extract($args);
?>
<div class="hvnly-property-results-header-left">
    <p id="hvnly-results-count">
        <?php if ($total_properties > 0): ?>

            <?php
            $hvnly_start_span = '<strong>' . esc_html($start) . '</strong>';
            $hvnly_end_span   = '<strong>' . esc_html($end) . '</strong>';
            $hvnly_total_span = '<strong>' . esc_html($total_properties) . '</strong>';

            $hvnly_properties_text = sprintf(
                /* translators: 1: start number, 2: end number, 3: total properties */
                __('Properties %1$s-%2$s of %3$s Properties', 'havenlytics'),
                $hvnly_start_span,
                $hvnly_end_span,
                $hvnly_total_span
            );

            echo wp_kses_post($hvnly_properties_text);
            ?>

            <?php if (!empty($current_filters['property_type'])): ?>
                <?php
                $hvnly_types = '<strong>' . esc_html(implode(', ', (array)$current_filters['property_type'])) . '</strong>';

                /* translators: %s: property type filter list */
                echo wp_kses_post(sprintf(__(' in %s', 'havenlytics'), $hvnly_types));
                ?>
            <?php endif; ?>

            <?php if (!empty($current_filters['location'])): ?>
                <?php
                $hvnly_locations = '<strong>' . esc_html(implode(', ', (array)$current_filters['location'])) . '</strong>';

                /* translators: %s: location filter list */
                echo wp_kses_post(sprintf(__(' in %s', 'havenlytics'), $hvnly_locations));
                ?>
            <?php endif; ?>

        <?php else: ?>
            <?php esc_html_e('No properties found', 'havenlytics'); ?>

            <?php if (!empty($current_filters['property_type'])): ?>
                <?php
                $hvnly_types = '<strong>' . esc_html(implode(', ', (array)$current_filters['property_type'])) . '</strong>';

                /* translators: %s: property type filter list */
                echo wp_kses_post(sprintf(__(' in %s', 'havenlytics'), $hvnly_types));
                ?>
            <?php endif; ?>
        <?php endif; ?>
    </p>
</div>