public function showAction(Request $request, FlattenException $exception, DebugLoggerInterface $logger = null, $_format = 'html')
    {
        $currentContent = $this->getAndCleanOutputBuffering($request->headers->get('X-Php-Ob-Level', -1));
        $code = $exception->getStatusCode();

        //get request extension
        $uriArray = explode('/', rtrim($request->getRequestUri(), '/'));

        $matches = preg_match('/^.*(\..*)$/', array_pop($uriArray), $matches);

        $locale = $request->getLocale();
        if (!in_array($locale, $this->availableLocales, true)) {
            $request->setLocale($this->defaultLocale);
        }
        //if in production environment and the query is not a file
        if ($this->debug === false && 0 === $matches) {
            $page = $this->em->getRepository('VictoireTwigBundle:ErrorPage')->findOneByCode($code);
            if ($page) {
                return $this->forward('VictoireTwigBundle:ErrorPage:show', [
                        'code' => $page->getCode(),
                ]);
            }
        }

        return new Response($this->twig->render(
            $this->findTemplate($request, $_format, $code, $this->debug),
            [
                'status_code'    => $code,
                'status_text'    => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '',
                'exception'      => $exception,
                'logger'         => $logger,
                'currentContent' => $currentContent,
            ]
        ));
    }