module Pagy::Frontend

def pagy_info(pagy, id: nil, item_name: nil)

Return examples: "Displaying items 41-60 of 324 in total" or "Displaying Products 41-60 of 324 in total"
def pagy_info(pagy, id: nil, item_name: nil)
  id      = %( id="#{id}") if id
  p_count = pagy.count
  key     = if p_count.zero?
              'pagy.info.no_items'
            elsif pagy.pages == 1
              'pagy.info.single_page'
            else
              'pagy.info.multiple_pages'
            end
  %(<span#{id} class="pagy info">#{
      pagy_t key, item_name: item_name || pagy_t('pagy.item_name', count: p_count),
                  count: p_count, from: pagy.from, to: pagy.to
    }</span>)
end