In order to get only a desired amount of items in the log the ':log' command should get an parameter N that displays only the last N items in the log.
(To simplify and reduce code this might lead to the restructuring of the command-matching routine.)