Thanks to @egreg and @UlrikeFischer for point out label issue at end of a document.
When a label is not recorded in an aux file, the label should be at the end of a document, and the page number of that label must be the last page.
Here is my solution:
\documentclass{article}
\usepackage{multicol}
\usepackage{zref-lastpage}% for LastPage
\makeatletter
\newcommand{\labelthispage}[1]{\zref@label{#1}}
\newcommand{\getl@beledpage}[1]{\zref@extractdefault{#1}{page}{-1}}
\newcommand{\getl@stpage}{\zref@extractdefault{LastPage}{page}{0}}
\newcommand{\getlabeledpage}[1]{\ifnum\getl@beledpage{#1}=-1 \getl@stpage \else \getl@beledpage{#1} \fi}
\makeatother
\begin{document}
\begin{multicols*}{2}
Some text.
\labelthispage{LABEL1}
\end{multicols*}
\edef\tmp{################ LABELED PAGE 1: \getlabeledpage{LABEL1}}
\typeout\tmp
\begin{multicols*}{2}
Other text.
\end{multicols*}
\labelthispage{LABEL2}
\edef\tmp{################ LABELED PAGE 2: \getlabeledpage{LABEL2}}
\typeout\tmp
\end{document}
Snippet of the 2nd compilation log:
(./issue_try_2.aux) [1]
################ LABELED PAGE 1: 1
[2]
################ LABELED PAGE 2: 2
(./issue_try_2.aux) )
The aux file:
\relax
\providecommand\zref@newlabel[2]{}
\zref@newlabel{LABEL1}{\default{}\page{1}\abspage{1}}
\zref@newlabel{LastPage}{\default{}\page{2}\abspage{2}}
LABEL2
not recorded in the aux file, and LastPage
value is used by \getlabeledpage{LABEL2}
multicol
output routine kicks in.zref-lastpage
which takes care of this.