$dom = PHPQuery::newDocument($html);
$elems = $dom->find('.navigation > .pagination > *');
if( $elems->length ) {
$penult = $elems->length - ($elems->length > 2 ? 2 : 1);
var_dump($elems->eq($penult)->text());
}
document.addEventListener('DOMContentLoaded', function (e) {
var activeShape = [], map = document.getElementById('map');
document.addEventListener('click', function (e) {
if (e.target.dataset.action != 'region') return;
var path = map.querySelectorAll('[data-id="' + e.target.dataset.id + '"]');
activeShape.length && activeShape.forEach(function(item) {
item.setAttribute('class', item.getAttribute('class').replace(/\s*\bactive\b/ig, ''));
});
path.length && path.forEach(function(item) {
item.setAttribute('class', item.getAttribute('class') + ' active');
activeShape.push(item);
});
});
});