original_string: public function blogAuthor(Request $request, Response $response)
      {
          $routeArgs =  $request->getAttribute('route')->getArguments();
  
          $checkAuthor = Users::where('username', $routeArgs['username'])->first();
  
          if (!$checkAuthor) {
              $this->flash('warning', 'Author not found.');
              return $this->redirect($response, 'blog');
          }
  
          // Get/Set Page Number
          $page = 1;
          if (isset($routeArgs['page']) && is_numeric($routeArgs['page'])) {
              $page = $routeArgs['page'];
          }
  
          $posts = BlogPosts::where('status', 1)
              ->where('user_id', $checkAuthor->id)
              ->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/author/".$checkAuthor->username."/(: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(
                  "author" => $checkAuthor,
                  "posts" => $posts->get(),
                  "pagination" => $pagination,
                  "authorPage" => true
              )
          );
      }
code: public function blogAuthor(Request $request, Response $response)
      {
          $routeArgs =  $request->getAttribute('route')->getArguments();
  
          $checkAuthor = Users::where('username', $routeArgs['username'])->first();
  
          if (!$checkAuthor) {
              $this->flash('warning', 'Author not found.');
              return $this->redirect($response, 'blog');
          }
  
          // Get/Set Page Number
          $page = 1;
          if (isset($routeArgs['page']) && is_numeric($routeArgs['page'])) {
              $page = $routeArgs['page'];
          }
  
          $posts = BlogPosts::where('status', 1)
              ->where('user_id', $checkAuthor->id)
              ->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/author/".$checkAuthor->username."/(: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(
                  "author" => $checkAuthor,
                  "posts" => $posts->get(),
                  "pagination" => $pagination,
                  "authorPage" => true
              )
          );
      }
code_tokens: public function blogAuthor ( Request $ request , Response $ response ) { $ routeArgs = $ request -> getAttribute ( 'route' ) -> getArguments ( ) ; $ checkAuthor = Users :: where ( 'username' , $ routeArgs [ 'username' ] ) -> first ( ) ; if ( ! $ checkAuthor ) { $ this -> flash ( 'warning' , 'Author not found.' ) ; return $ this -> redirect ( $ response , 'blog' ) ; } // Get/Set Page Number $ page = 1 ; if ( isset ( $ routeArgs [ 'page' ] ) && is_numeric ( $ routeArgs [ 'page' ] ) ) { $ page = $ routeArgs [ 'page' ] ; } $ posts = BlogPosts :: where ( 'status' , 1 ) -> where ( 'user_id' , $ checkAuthor -> id ) -> 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/author/" . $ checkAuthor -> username . "/(: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 ( "author" => $ checkAuthor , "posts" => $ posts -> get ( ) , "pagination" => $ pagination , "authorPage" => true ) ) ; }
docstring: Author Posts Page
docstring_tokens: Author Posts Page