<commit_before><?php

class FactureLatex extends GenericLatex {

  private $facture = null;

  const MAX_LIGNES_PERPAGE = 50;
  const NB_LIGNES_PAPILLONS_FIXE = 2;
  const NB_LIGNES_PAPILLONS_PAR_ECHEANCE = 3;
  const NB_LIGNES_ENTETE = 10;
  const NB_LIGNES_REGLEMENT = 7;
  const MAX_NB_LIGNES_ORGA = 3;

  function __construct(Facture $f, $config = null) {
    sfProjectConfiguration::getActive()->loadHelpers("Partial", "Url", "MyHelper");
    $this->facture = $f;
  }

  public function getNbLignes() {
    $nbLignes = $this->facture->getNbLignesMouvements() + self::NB_LIGNES_REGLEMENT + self::NB_LIGNES_ENTETE + self::MAX_NB_LIGNES_ORGA;
    $nb_echeances = count($this->facture->echeances);
    if ($nb_echeances)
      $nbLignes += self::NB_LIGNES_PAPILLONS_FIXE + self::NB_LIGNES_PAPILLONS_PAR_ECHEANCE * $nb_echeances;
    return $nbLignes;
  }
  
  public function getNbPages() {
    return floor(($this->getNbLignes()/ self::MAX_LIGNES_PERPAGE) + 1);
  }
  
  private function getFileNameWithoutExtention() {
    return  'facture_'.$this->facture->identifiant.'_'.str_replace('/', '-', $this->facture->numero_interloire).'_'.$this->facture->numero_facture.'_'.$this->facture->_rev;
  }

  public function getLatexFileNameWithoutExtention() {
    return $this->getTEXWorkingDir().$this->getFileNameWithoutExtention();
  }


  public function getLatexFileContents() {
    return html_entity_decode(htmlspecialchars_decode(
						      get_partial('facture/latexContent', array('facture' => $this->facture,
												'nb_pages' => $this->getNbPages(),
												'nb_lines' => $this->getNbLignes()))
						      , HTML_ENTITIES));
  }


  public function getFactureId() {
    return $this->facture->_id;
  }

  public function getPublicFileName($extention = '.pdf') {
    return $this->getFileNameWithoutExtention().$extention;
  }

}
<commit_msg>pdf de 3 pages à partir de 48 lignes<commit_after><?php

class FactureLatex extends GenericLatex {

  private $facture = null;

  const MAX_LIGNES_PERPAGE = 48;
  const NB_LIGNES_PAPILLONS_FIXE = 2;
  const NB_LIGNES_PAPILLONS_PAR_ECHEANCE = 3;
  const NB_LIGNES_ENTETE = 10;
  const NB_LIGNES_REGLEMENT = 7;
  const MAX_NB_LIGNES_ORGA = 3;

  function __construct(Facture $f, $config = null) {
    sfProjectConfiguration::getActive()->loadHelpers("Partial", "Url", "MyHelper");
    $this->facture = $f;
  }

  public function getNbLignes() {
    $nbLignes = $this->facture->getNbLignesMouvements() + self::NB_LIGNES_REGLEMENT + self::NB_LIGNES_ENTETE + self::MAX_NB_LIGNES_ORGA;
    $nb_echeances = count($this->facture->echeances);
    if ($nb_echeances)
      $nbLignes += self::NB_LIGNES_PAPILLONS_FIXE + self::NB_LIGNES_PAPILLONS_PAR_ECHEANCE * $nb_echeances;
    return $nbLignes;
  }

  public function getNbPages() {
    return floor(($this->getNbLignes()/ self::MAX_LIGNES_PERPAGE) + 1);
  }

  private function getFileNameWithoutExtention() {
    return  'facture_'.$this->facture->identifiant.'_'.str_replace('/', '-', $this->facture->numero_interloire).'_'.$this->facture->numero_facture.'_'.$this->facture->_rev;
  }

  public function getLatexFileNameWithoutExtention() {
    return $this->getTEXWorkingDir().$this->getFileNameWithoutExtention();
  }


  public function getLatexFileContents() {
    return html_entity_decode(htmlspecialchars_decode(
						      get_partial('facture/latexContent', array('facture' => $this->facture,
												'nb_pages' => $this->getNbPages(),
												'nb_lines' => $this->getNbLignes()))
						      , HTML_ENTITIES));
  }


  public function getFactureId() {
    return $this->facture->_id;
  }

  public function getPublicFileName($extention = '.pdf') {
    return $this->getFileNameWithoutExtention().$extention;
  }

}

{'fraction_non_alphanumeric': 0.13800481412142285, 'fraction_numerical': 0.00561647499331372, 'mean_word_length': 4.428156748911466, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2767519', 'n_tokens_mistral': 1492, 'n_tokens_neox': 1357, 'n_words': 200}