[ticket/12232] Remove excessive calls to sizeof() in assign_block_vars() method

The size of the template block array is calculated within a foreach loop
iterating through the array, which is unnecessary. It only needs to be done
once. In a block of 1000 rows, this results in
500,500 calls to sizeof() in this location. With this change, that's reduced to
1000.

PHPBB3-12232
[ticket/12232] Fix a similar excessive pattern in the method.

PHPBB3-12232
Merge pull request #2065 from prototech/ticket/12232

[ticket/12232] Remove excessive calls to sizeof() in assign_block_vars() method.