original_string: public function get_total_discussion_count_from_forum_id(
          int $forumid,
          bool $includehiddendiscussions,
          ?int $includepostsforuser
      ) {
          $alias = $this->get_table_alias();
  
          $wheresql = "{$alias}.forum = :forumid";
  
          [
              'wheresql' => $hiddensql,
              'params' => $hiddenparams
          ] = $this->get_hidden_post_sql($includehiddendiscussions, $includepostsforuser);
          $wheresql .= $hiddensql;
  
          $params = array_merge($hiddenparams, [
              'forumid' => $forumid,
          ]);
  
          return $this->get_db()->count_records_sql($this->generate_count_records_sql($wheresql), $params);
      }
code: public function get_total_discussion_count_from_forum_id(
          int $forumid,
          bool $includehiddendiscussions,
          ?int $includepostsforuser
      ) {
          $alias = $this->get_table_alias();
  
          $wheresql = "{$alias}.forum = :forumid";
  
          [
              'wheresql' => $hiddensql,
              'params' => $hiddenparams
          ] = $this->get_hidden_post_sql($includehiddendiscussions, $includepostsforuser);
          $wheresql .= $hiddensql;
  
          $params = array_merge($hiddenparams, [
              'forumid' => $forumid,
          ]);
  
          return $this->get_db()->count_records_sql($this->generate_count_records_sql($wheresql), $params);
      }
code_tokens: public function get_total_discussion_count_from_forum_id ( int $ forumid , bool $ includehiddendiscussions , ? int $ includepostsforuser ) { $ alias = $ this -> get_table_alias ( ) ; $ wheresql = "{$alias}.forum = :forumid" ; [ 'wheresql' => $ hiddensql , 'params' => $ hiddenparams ] = $ this -> get_hidden_post_sql ( $ includehiddendiscussions , $ includepostsforuser ) ; $ wheresql .= $ hiddensql ; $ params = array_merge ( $ hiddenparams , [ 'forumid' => $ forumid , ] ) ; return $ this -> get_db ( ) -> count_records_sql ( $ this -> generate_count_records_sql ( $ wheresql ) , $ params ) ; }
docstring: Count the number of discussions in the forum.
  
  @param int $forumid Id of the forum to count discussions in
  @param bool $includehiddendiscussions Include hidden dicussions in the count?
  @param int|null $includepostsforuser Include discussions created by this user in the count
  (only works if not including hidden discussions).
  @return int
docstring_tokens: Count the number of discussions in the forum .