/**
* Sets the document title according to Global Configuration options
*
* @param string $title The page title
*
* @return void
*
* @since 3.6
*/
public function setDocumentTitle($title)
{
$app = Factory::getApplication();
// Check for empty title and add site name if param is set
if (empty($title)) {
$title = $app->get('sitename');
} elseif ($app->get('sitename_pagetitles', 0) == 1) {
$title = Text::sprintf('JPAGETITLE', $app->get('sitename'), $title);
} elseif ($app->get('sitename_pagetitles', 0) == 2) {
$title = Text::sprintf('JPAGETITLE', $title, $app->get('sitename'));
}
$this->document->setTitle($title);
}