/**
 * Render pagination links
 *
 * This uses ProcessWire's MarkupPagerNav module and overrides the default
 * markup to focus on Foundation-specific pagination styles.
 *
 */
function renderPagination(PageArray $items)
{
    if (!$items->getLimit() || $items->getTotal() <= $items->getLimit()) {
        return '';
    }
    $page = wire('page');
    if (!$page->template->allowPageNum) {
        // notify developer they need to enable pagination in the template
        return "<p class='alert label'>" . "This template needs page numbers enabled to support pagination!<br />" . "Go to: Admin - Setup - Templates - Edit: '{$page->template}' - URLs " . "</p>";
    }
    // customize the MarkupPagerNav to output in Foundation-style pagination links
    $options = array('nextItemLabel' => '&raquo;', 'nextItemClass' => 'arrow', 'previousItemLabel' => '&laquo;', 'previousItemClass' => 'arrow', 'lastItemClass' => 'last', 'currentItemClass' => 'current', 'separatorItemLabel' => '&hellip;', 'separatorItemClass' => 'unavailable', 'listMarkup' => "<ul class='pagination'>{out}</ul>", 'itemMarkup' => "<li class='{class}'>{out}</li>", 'linkMarkup' => "<a href='{url}'>{out}</a>");
    $pager = wire('modules')->get('MarkupPagerNav');
    $pager->setBaseUrl(wire('page')->url);
    return $pager->render($items, $options);
}