如何在FPDF中获得一半的总页数?

I was able to get the total page number using this answer (second one), but is there a way to get half of the total pages in FPDF?

I tried with

$pdf->AddPage();
$pdf->totalPages = '{totalPages}';
$pdf->AliasNbPages('{totalPages}');
$pdf->halftotalPages = $pdf->totalPages / 2;

Warning: A non-numeric value encountered

As $pdf->totalPages is {totalPages} and it is not a number. How can I get half of the total pages?