<?php
$toolbarHelper = $this->helper('Wyomind\ElasticsearchLayeredNavigation\Helper\Toolbar');
$configHelper = $this->helper('Wyomind\ElasticsearchLayeredNavigation\Helper\Config');
$dataHelper = $this->helper('Wyomind\ElasticsearchCore\Helper\Data');
$storeId = $dataHelper->getCurrentStoreId();
$labels = $configHelper->getLabels($storeId);
$perPageLabels = explode("{{control}}", $labels['per_page_dropdown']);
if (count($perPageLabels)) {
    $beforeLabel = $perPageLabels[0];
} else {
    $beforeLabel = __("Show");
}
if (count($perPageLabels) > 1) {
    $afterLabel = $perPageLabels[1];
} else {
    $afterLabel = __("items per page");
}
?>
<div class="field limiter eln-limiter">
    <?php if ($beforeLabel != ""): ?>
        <label class="label" for="limiter">
            <span><?= /* @noEscape */ $beforeLabel ?></span>
        </label>
    <?php endif; ?>
    <div class="control">
        <select id="limiter" data-role="limiter" class="limiter-options">
            <?php foreach ($toolbarHelper->getAvailableLimit() as $_key => $_limit): ?>
                <option value="<?= $block->escapeHtml($_key) ?>"<?php if ($toolbarHelper->getCurrentPerPage() == $_key): ?> selected="selected"<?php endif ?>>
                    <?= $block->escapeHtml($_limit) ?>
                </option>
            <?php endforeach; ?>
        </select>
    </div>
    <?php if ($afterLabel != "") : ?>
        <span class="limiter-text"><?= /* @noEscape */ $afterLabel ?></span>
    <?php endif; ?>
</div>