public function reportHistoryJsonAction($reportUri = null) {
        //Get the sent parameters from datatables
        $limit   = $this->container->get('request')->query->get('length');
        $offset  = $this->container->get('request')->query->get('start');

        //Create a new repsonse array that will be converted to json
        $response = array();

        //Get the history for the given report from the report history
        $records = $this->container->get('mesd.jasper.report.history')->getReportHistoryDisplay(
            urldecode($reportUri), true, array('limit' => $limit, 'offset' => $offset));

        if ($reportUri) {
            //Get the count of records
            $count = $this->container->get('mesd.jasper.report.history')->loadHistoryForReport(
                urldecode($reportUri), true, array('count' => true));
        } else {
            //Get the count of records
            $count = $this->container->get('mesd.jasper.report.history')->loadRecentHistory(
                true, array('count' => true));
        }

        $response['recordsTotal'] = $count;
        $response['recordsFiltered'] = $count;

        //Convert the records to an array
        $response['data'] = array();
        foreach($records as $record) {
            //Create the links
            $links = array();
            foreach(json_decode($record['formats']) as $format) {
                //If html handle it differently, else export like usual
                if ('html' === $format) {
                    $href = $this->container->get('router')->generate('MesdJasperReportViewerBundle_display_history_report_viewer', array(
                            'reportUri' => urlencode($record['report']),
                            'existing' => $record['requestId']
                        )
                    );
                } else {
                    $href = $this->container->get('router')->generate('MesdJasperReportBundle_export_cached_report', array(
                            'requestId' => $record['requestId'],
                            'format' => $format
                        )
                    );
                }
                $links[] = '<a href="' . $href . '">' . $format . '</a>';
            }

            //Convert to the format that datatables can read
            $response['data'][] = array(
                $record['report'],
                $record['date']->format('Y-m-d H:i:s'),
                $record['parameters'],
                implode('  ', $links)
            );
        }

        //Send back the Json
        return new JsonResponse($response);
    }