private function getEditReferrer(Request $request)
    {
        $tmp = parse_url($request->server->get('HTTP_REFERER'));

        $referrer = $tmp['path'];
        if (!empty($tmp['query'])) {
            $referrer .= '?' . $tmp['query'];
        }

        if (strpos($referrer, '/overview/') !== false || ($referrer === $this->generateUrl('dashboard') . '/')) {
            if ($this->getOption('general/compatibility/twig_globals', true)) {
                $this->app['twig']->addGlobal('editreferrer', $referrer);
            }

            return $referrer;
        }

        return null;
    }