You can replace all of this
```
    global $objPage;
    $arrRow = array(
        'id' => $objPage->id,
        'alias' => $objPage->alias
    );
    if (empty($params))
    {
      return $this->generateFrontendUrl($arrRow);
    }
    else 
    {
      $strParams = '/' . implode('/', $params);
      return $this->generateFrontendUrl($arrRow, $strParams);
    }
```
with:
```
return $this->generateFrontendUrl($arrRow, (!empty($params) ? $strParams : null));
```