def generate_pagination
        total_records = @args[:records].is_a?(Hash) ? @args[:records][:total] : @args[:records].length
        total_records_per_page = @args[:records].is_a?(Hash) ? @args[:records][:per_page] : @args[:records].length
        total_pages = (total_records.to_f / total_records_per_page.to_f).ceil
        current_page = @args[:records].is_a?(Hash) ? @args[:records][:pagination] : 1

        search_value = @args[:records].is_a?(Hash) ? @args[:records][:search] : ''
        sort_value = @args[:records].is_a?(Hash) ? @args[:records][:sort] : ''
        sort_dir_value = @args[:records].is_a?(Hash) ? @args[:records][:sort_dir] : ''

        url = core__add_param_to_url(@args[:index_url], 'widget_index[search]', search_value)
        url = core__add_param_to_url(url, 'widget_index[sort]', sort_value)
        url = core__add_param_to_url(url, 'widget_index[sort_dir]', sort_dir_value)
        return LatoCore::Elements::Pagination::Cell.new(total: total_pages, current: current_page, url: url,
        param: 'widget_index[pagination]')
      end
def generate_pagination
        total_records = @args[:records].is_a?(Hash) ? @args[:records][:total] : @args[:records].length
        total_records_per_page = @args[:records].is_a?(Hash) ? @args[:records][:per_page] : @args[:records].length
        total_pages = (total_records.to_f / total_records_per_page.to_f).ceil
        current_page = @args[:records].is_a?(Hash) ? @args[:records][:pagination] : 1

        search_value = @args[:records].is_a?(Hash) ? @args[:records][:search] : ''
        sort_value = @args[:records].is_a?(Hash) ? @args[:records][:sort] : ''
        sort_dir_value = @args[:records].is_a?(Hash) ? @args[:records][:sort_dir] : ''

        url = core__add_param_to_url(@args[:index_url], 'widget_index[search]', search_value)
        url = core__add_param_to_url(url, 'widget_index[sort]', sort_value)
        url = core__add_param_to_url(url, 'widget_index[sort_dir]', sort_dir_value)
        return LatoCore::Elements::Pagination::Cell.new(total: total_pages, current: current_page, url: url,
        param: 'widget_index[pagination]')
      end
Pagination generation: