public function blog(Request $request, Response $response)
    {

        // Get Page Number
        $page = 1;
        $routeArgs =  $request->getAttribute('route')->getArguments();
        if (isset($routeArgs['page']) && is_numeric($routeArgs['page'])) {
            $page = $routeArgs['page'];
        }

        $posts = BlogPosts::where('status', 1)
            ->where('publish_at', '<', Carbon::now())
            ->with('category', 'tags', 'author')
            ->withCount('comments', 'pendingComments')
            ->orderBy('publish_at', 'DESC');
     
        $pagination = new Paginator($posts->count(), $this->config['blog-per-page'], $page, "/blog/(:num)");
        $pagination = $pagination;

        $posts = $posts->skip($this->config['blog-per-page']*($page-1))
            ->take($this->config['blog-per-page']);
        
        return $this->view->render(
            $response,
            'blog.twig',
            array("posts" => $posts->get(), "pagination" => $pagination)
        );
    }