issue5724:
- added option "consoleCommandHistoryMax"
- fixed order of commands when commandHistoryMax is reached