public function log() { if ($this->getCurrentOptionValue()) { $uri = $this->getFullActionName(); $log = new Core_Model_Log(); $detect = new Mobile_Detect(); $host = !empty($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : ''; $user_agent = !empty($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''; $other = array('user_agent' => $user_agent, 'host' => $host); if ($this->getSession()->getCustomerId()) { $log->setCustomerId($this->getSession()->getCustomerId()); } $log->setUri($uri)->setDeviceName($detect->getDeviceName())->setOther(serialize($other))->save(); } return $this; }