public function handleRecentItems(SS_HTTPRequest $request)
    {
        $result = array();

        $fileIDs = File::get()
            ->sort('LastEdited', 'DESC')
            ->limit($this->config()->recent_items_limit)
            ->column('ID');

        if (!empty($fileIDs)) {
            $files = File::get()
                ->sort($this->getSortClause($request->getVar('sort')))
                ->byIDs($fileIDs);

            foreach ($files as $file) {
                if (!$file->canView()) {
                    continue;
                }

                $result[] = ($file instanceof Folder) ?
                    $this->createFolderJson($file) :
                    $this->createFileJson($file);

            }
        }

        $response = new SS_HTTPResponse(
            Convert::array2json($result), 200
        );

        return $response->addHeader('Content-Type', 'application/json');
    }