Say you want to `\pageref` to an index and/or glossary, how can you label the index/glossary?

The following approaches fail (for evident reasons):

```
\label{glos}
\printglossary

\label{idx}
\printindex

```

(labeled before the index and glossary)

```
\printglossary
\label{glos}

\printindex
\label{idx}

```

(labeled at last page of the index and glossary)

How can one label the index and glossary?

**MWE**:

```
\documentclass{article}
\usepackage{makeidx,glossaries}
\makeindex
\makeglossaries

\begin{document}
In this example we introduce \index{text}\newglossaryentry{text}{name={text},description={foo}}text. You can consult the glossary on page \pageref{glos} and the index on page \pageref{idx}.

\label{glos}
\printglossary
\label{idx}
\printindex
\end{document}

```