Skip to content

Commit

Permalink
Done due dilligence and preg_quote-d variable used in preg_replace; t…
Browse files Browse the repository at this point in the history
…his fixes #26
  • Loading branch information
stefangabos committed May 2, 2021
1 parent 6ad07bd commit 06316a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Zebra_Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -825,13 +825,13 @@ private function _build_uri($page) {
if ($this->_properties['method'] == 'url') {

// see if the current page is already set in the URL
if (preg_match('/\b' . $this->_properties['variable_name'] . '([0-9]+)\b/i', $this->_properties['base_url']) > 0) {
if (preg_match('/\b' . preg_quote($this->_properties['variable_name']) . '([0-9]+)\b/i', $this->_properties['base_url']) > 0) {

// build string
$url = str_replace('//', '/', preg_replace(

// replace the currently existing value
'/\b' . $this->_properties['variable_name'] . '([0-9]+)\b/i',
'/\b' . preg_quote($this->_properties['variable_name']) . '([0-9]+)\b/i',

// if on the first page abd we are avoiding duplicate content, remove it in order to avoid duplicate content
($page == 1 && $this->_properties['avoid_duplicate_content'] ? '' : $this->_properties['variable_name'] . $page),
Expand Down

0 comments on commit 06316a8

Please sign in to comment.